//
//  LXActionCell.m
//  LXActionCell
//
//  Created by lachesis-zhu on 16/4/26.
//  Copyright © 2016年 yafeng.zhu@lachesis-mh.com. All rights reserved.
//

#import "LXActionCell.h"

@interface LXActionCell()

//@property (nonatomic , strong) UIImageView *leftView;
@property (nonatomic , strong) UILabel *titleLabel;

@end

@implementation LXActionCell

//在initWithStyle中，生成控件，将控件添加到self.contentView中
-(id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if(self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]){
        _titleLabel = [[UILabel alloc] init];
        _titleLabel.backgroundColor = [UIColor clearColor];
        _titleLabel.textAlignment = NSTextAlignmentCenter;
        _titleLabel.font = [UIFont lx_systemFontOfSize:20];
        [self.contentView addSubview:_titleLabel];
        self.selectionStyle = UITableViewCellSelectionStyleNone;
    }
    return self;
}

//在layoutSubviews中，设置控件的frame
-(void)layoutSubviews{
    [super layoutSubviews];
    _titleLabel.frame = CGRectMake(15, 5, CGRectGetWidth(self.frame) - 30, CGRectGetHeight(self.frame) - 10);
    _titleLabel.textColor = kAppNormalTextColor;
}

//设置数据
-(void)setData:(NSString *)title{
    _titleLabel.text = title;
}

//设置点击事件
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    if (selected) {
        self.backgroundColor = RGBCOLOR(12, 102, 188);
    }else{
        self.backgroundColor = [UIColor whiteColor];
    }
    
}

@end
